package com.java110.mall.goods.cmd.housekeepingType;

import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.housekeeping.HousekeepingTypeDto;
import com.java110.mall.goods.bmo.housekeepingType.IGetHousekeepingTypeBMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;

@Java110Cmd(serviceCode = "housekeepingType.queryHousekeepingType")
public class QueryHousekeepingTypeCmd extends Cmd {
    @Autowired
    private IGetHousekeepingTypeBMO getHousekeepingTypeBMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
        super.validatePageInfo(reqJson);
    }

    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
        HousekeepingTypeDto housekeepingTypeDto = BeanConvertUtil.covertBean(reqJson,HousekeepingTypeDto.class);
        ResponseEntity<String> responseEntity =  getHousekeepingTypeBMOImpl.get(housekeepingTypeDto);
        cmdDataFlowContext.setResponseEntity(responseEntity);
    }
}
